package com.mccrea.pattern.decorator;

import java.math.BigDecimal;

/**
 * @author mccrea
 * @version 1.0
 * @description: 装饰着
 * @date 2021/5/9 11:49
 */
public class Decorator extends Drink{
    private Drink drink;

    public Decorator(Drink drink) {
        this.drink = drink;
    }

    @Override
    BigDecimal cost() {
        return super.getPrice().add(drink.cost());
    }

    @Override
    public String getDes() {
        return super.getDes() + " " + super.getPrice() + "&&" + drink.getDes();
    }
}
